﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MdcService.Log
{
    public class FileTraceListener:TraceListener
    {
        private readonly string _logpath;
        public FileTraceListener(string logpath)
        {
            this._logpath = logpath;
        }

        public override void Write(string message)
        {
            File.AppendAllText(_logpath, message);
        }

        public override void WriteLine(string message)
        {
            File.AppendAllText(_logpath, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss    ") + message + Environment.NewLine);
        }
    }
}
